package com.gitee.cashzhang27.test.boot.other.config;


import java.lang.reflect.Method;
import java.util.Arrays;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Cash Zhang
 * @version v1.0
 * @since 2019/02/17 12:48
 */
@Configuration
public class MyCacheConfig {

  @Bean("myKeyGenerator")
  public KeyGenerator keyGenerator() {
    return (Object target, Method method, Object... params) -> method.getName() + Arrays
        .asList(params).toString();
  }
}
